﻿using System;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Udp.SendCNT
{
    class Program
    {
        static async Task Main(string[] args)
        {
            if (args.Length > 0)
            {
                var host = args[0];
                var msg = args[1];
                var udpCnt = new UdpClient(Constants.UdpSendPort);
                var bytes = Encoding.UTF8.GetBytes(msg);
                var result = await udpCnt.SendAsync(bytes, bytes.Length, host, Constants.UdpPort);
                Console.WriteLine($"send success, send bytes length: {result}.");
            }
            else
                Console.WriteLine("please input 2 args.");
        }
    }
}
